var express = require('express');
var router = express.Router();

const {sha256} = require('../utils/token');

const userService = require("../service/userService");
/* GET users listing. */
router.post('/login', async function(req, res, next) {
  const result = await userService.findByUsernameAndPwd(req.body.username,sha256(req.body.pwd));
  if(result.status == 1){
    req.session.user = result;

  }
  res.send(result);
});

module.exports = router;
